<!DOCTYPE html>
<html lang=zh>
<head>
  <meta charset="utf-8">
  
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui">
  <meta name="renderer" content="webkit">
  <meta http-equiv="Cache-Control" content="no-transform" />
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="format-detection" content="telephone=no,email=no,adress=no">
  <!-- Color theme for statusbar -->
  <meta name="theme-color" content="#000000" />
  <!-- 强制页面在当前窗口以独立页面显示,防止别人在框架里调用页面 -->
  <meta http-equiv="window-target" content="_top" />
  
  
  <title>lvm | 惘客的个人博客</title>
  <meta name="description" content="简介LVM(Logical Volume Manager) 是Linux下基于物理块设备(磁盘和磁盘分区等)之上创建虚拟块设备并对其进行管理的一种机制。相比直接管理物理设备，虚拟设备的管理会更加方便，也更容易拓展。LVM的出现解决了传统的磁盘管理会存在每个磁盘分区大小固定且无法动态拓展(不停止应用程序，不卸载文件系统)的问题。 概念 PV：Physical Volume，物理卷，对应物理块设备，即">
<meta property="og:type" content="article">
<meta property="og:title" content="lvm">
<meta property="og:url" content="https://gycherish.gitee.io/blog/posts/624d6a49.html">
<meta property="og:site_name" content="惘客的个人博客">
<meta property="og:description" content="简介LVM(Logical Volume Manager) 是Linux下基于物理块设备(磁盘和磁盘分区等)之上创建虚拟块设备并对其进行管理的一种机制。相比直接管理物理设备，虚拟设备的管理会更加方便，也更容易拓展。LVM的出现解决了传统的磁盘管理会存在每个磁盘分区大小固定且无法动态拓展(不停止应用程序，不卸载文件系统)的问题。 概念 PV：Physical Volume，物理卷，对应物理块设备，即">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://gycherish.gitee.io/blog/images/FileSystem/lvm/Lvm.svg">
<meta property="article:published_time" content="2021-03-28T16:00:00.000Z">
<meta property="article:modified_time" content="2022-05-16T14:52:25.374Z">
<meta property="article:author" content="惘客">
<meta property="article:tag" content="fs">
<meta property="article:tag" content="lvm">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://gycherish.gitee.io/blog/images/FileSystem/lvm/Lvm.svg">
  <!-- Canonical links -->
  <link rel="canonical" href="https://gycherish.gitee.io/blog/posts/624d6a49.html">
  
    <link rel="alternate" href="/atom.xml" title="惘客的个人博客" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png" type="image/x-icon">
  
  
<link rel="stylesheet" href="/blog/css/style.css">

  
  
  
  
<meta name="generator" content="Hexo 4.2.1"></head>


<body class="main-center theme-black" itemscope itemtype="http://schema.org/WebPage">
  <header class="header" itemscope itemtype="http://schema.org/WPHeader">
  <div class="slimContent">
    <div class="navbar-header">
      
      
      <div class="profile-block text-center">
        <a id="avatar" href="https://gitee.com/gycherish" target="_blank">
          <img class="img-circle img-rotate" src="/blog/images/head.jpg" width="200" height="200">
        </a>
        <h2 id="name" class="hidden-xs hidden-sm">惘客</h2>
        <h3 id="title" class="hidden-xs hidden-sm hidden-md">Linux C++ Server Developer</h3>
        <small id="location" class="text-muted hidden-xs hidden-sm"><i class="icon icon-map-marker"></i> Shanghai, China</small>
      </div>
      
      <div class="search" id="search-form-wrap">

    <form class="search-form sidebar-form">
        <div class="input-group">
            <input type="text" class="search-form-input form-control" placeholder="搜索" />
            <span class="input-group-btn">
                <button type="submit" class="search-form-submit btn btn-flat" onclick="return false;"><i class="icon icon-search"></i></button>
            </span>
        </div>
    </form>
    <div class="ins-search">
  <div class="ins-search-mask"></div>
  <div class="ins-search-container">
    <div class="ins-input-wrapper">
      <input type="text" class="ins-search-input" placeholder="想要查找什么..." x-webkit-speech />
      <button type="button" class="close ins-close ins-selectable" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
    </div>
    <div class="ins-section-wrapper">
      <div class="ins-section-container"></div>
    </div>
  </div>
</div>


</div>
      <button class="navbar-toggle collapsed" type="button" data-toggle="collapse" data-target="#main-navbar" aria-controls="main-navbar" aria-expanded="false">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
    </div>
    <nav id="main-navbar" class="collapse navbar-collapse" itemscope itemtype="http://schema.org/SiteNavigationElement" role="navigation">
      <ul class="nav navbar-nav main-nav ">
        
        
        <li class="menu-item menu-item-home">
          <a href="/blog/.">
            
            <i class="icon icon-home-fill"></i>
            
            <span class="menu-title">首页</span>
          </a>
        </li>
        
        
        <li class="menu-item menu-item-archives">
          <a href="/blog/archives">
            
            <i class="icon icon-archives-fill"></i>
            
            <span class="menu-title">归档</span>
          </a>
        </li>
        
        
        <li class="menu-item menu-item-categories">
          <a href="/blog/categories">
            
            <i class="icon icon-folder"></i>
            
            <span class="menu-title">分类</span>
          </a>
        </li>
        
        
        <li class="menu-item menu-item-tags">
          <a href="/blog/tags">
            
            <i class="icon icon-tags"></i>
            
            <span class="menu-title">标签</span>
          </a>
        </li>
        
        
        <li class="menu-item menu-item-repository">
          <a href="/blog/repository">
            
            <i class="icon icon-project"></i>
            
            <span class="menu-title">项目</span>
          </a>
        </li>
        
        
        <li class="menu-item menu-item-about">
          <a href="/blog/about">
            
            <i class="icon icon-cup-fill"></i>
            
            <span class="menu-title">关于</span>
          </a>
        </li>
        
      </ul>
      
	
    <ul class="social-links">
    	
        <li><a href="https://gitee.com/gycherish" target="_blank" title="Gitee" data-toggle=tooltip data-placement=top><i class="icon icon-gitee"></i></a></li>
        
        <li><a href="/blog/atom.xml" target="_blank" title="Rss" data-toggle=tooltip data-placement=top><i class="icon icon-rss"></i></a></li>
        
    </ul>

    </nav>
  </div>
</header>

  
    <aside class="sidebar" itemscope itemtype="http://schema.org/WPSideBar">
  <div class="slimContent">
    
      <div class="widget">
    <h3 class="widget-title">公告</h3>
    <div class="widget-body">
        <div id="board">
            <div class="content">
                <p>欢迎交流与分享经验!</p>
            </div>
        </div>
    </div>
</div>

    
      

    
      
  <div class="widget">
    <h3 class="widget-title">标签</h3>
    <div class="widget-body">
      <ul class="tag-list" itemprop="keywords"><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/bios/" rel="tag">bios</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/c/" rel="tag">c++</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/cmake/" rel="tag">cmake</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/cpu/" rel="tag">cpu</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/develop/" rel="tag">develop</a><span class="tag-list-count">6</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/docker/" rel="tag">docker</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/dpdk/" rel="tag">dpdk</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/fs/" rel="tag">fs</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/git/" rel="tag">git</a><span class="tag-list-count">4</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/hexo/" rel="tag">hexo</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/linux/" rel="tag">linux</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/lvm/" rel="tag">lvm</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/mbr/" rel="tag">mbr</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/os/" rel="tag">os</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/phabricator/" rel="tag">phabricator</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/tmux/" rel="tag">tmux</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/yum/" rel="tag">yum</a><span class="tag-list-count">1</span></li></ul>
    </div>
  </div>


    
      
  <div class="widget">
    <h3 class="widget-title">标签云</h3>
    <div class="widget-body tagcloud">
      <a href="/blog/tags/bios/" style="font-size: 13px;">bios</a> <a href="/blog/tags/c/" style="font-size: 13px;">c++</a> <a href="/blog/tags/cmake/" style="font-size: 13px;">cmake</a> <a href="/blog/tags/cpu/" style="font-size: 13px;">cpu</a> <a href="/blog/tags/develop/" style="font-size: 14px;">develop</a> <a href="/blog/tags/docker/" style="font-size: 13px;">docker</a> <a href="/blog/tags/dpdk/" style="font-size: 13px;">dpdk</a> <a href="/blog/tags/fs/" style="font-size: 13.25px;">fs</a> <a href="/blog/tags/git/" style="font-size: 13.75px;">git</a> <a href="/blog/tags/hexo/" style="font-size: 13.5px;">hexo</a> <a href="/blog/tags/linux/" style="font-size: 13.5px;">linux</a> <a href="/blog/tags/lvm/" style="font-size: 13px;">lvm</a> <a href="/blog/tags/mbr/" style="font-size: 13px;">mbr</a> <a href="/blog/tags/os/" style="font-size: 13.25px;">os</a> <a href="/blog/tags/phabricator/" style="font-size: 13px;">phabricator</a> <a href="/blog/tags/tmux/" style="font-size: 13px;">tmux</a> <a href="/blog/tags/yum/" style="font-size: 13px;">yum</a>
    </div>
  </div>

    
      
  <div class="widget">
    <h3 class="widget-title">归档</h3>
    <div class="widget-body">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/blog/archives/2022/05/">五月 2022</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/blog/archives/2022/04/">四月 2022</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/blog/archives/2022/01/">一月 2022</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/blog/archives/2021/08/">八月 2021</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/blog/archives/2021/05/">五月 2021</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/blog/archives/2021/03/">三月 2021</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/blog/archives/2020/06/">六月 2020</a><span class="archive-list-count">4</span></li><li class="archive-list-item"><a class="archive-list-link" href="/blog/archives/2020/05/">五月 2020</a><span class="archive-list-count">9</span></li><li class="archive-list-item"><a class="archive-list-link" href="/blog/archives/2019/11/">十一月 2019</a><span class="archive-list-count">1</span></li></ul>
    </div>
  </div>


    
      
  <div class="widget">
    <h3 class="widget-title">最新文章</h3>
    <div class="widget-body">
      <ul class="recent-post-list list-unstyled no-thumbnail">
        
          <li>
            
            <div class="item-inner">
              <p class="item-category">
                
              </p>
              <p class="item-title">
                <a href="/blog/posts/dc0447d5.html" class="title">bios</a>
              </p>
              <p class="item-date">
                <time datetime="2022-05-17T09:35:00.000Z" itemprop="datePublished">2022-05-17</time>
              </p>
            </div>
          </li>
          
          <li>
            
            <div class="item-inner">
              <p class="item-category">
                
              </p>
              <p class="item-title">
                <a href="/blog/posts/57db9b5a.html" class="title">Intel处理器架构简介</a>
              </p>
              <p class="item-date">
                <time datetime="2022-05-16T07:05:00.000Z" itemprop="datePublished">2022-05-16</time>
              </p>
            </div>
          </li>
          
          <li>
            
            <div class="item-inner">
              <p class="item-category">
                
              </p>
              <p class="item-title">
                <a href="/blog/posts/7d606a33.html" class="title">高性能编程指南</a>
              </p>
              <p class="item-date">
                <time datetime="2022-04-07T09:30:00.000Z" itemprop="datePublished">2022-04-07</time>
              </p>
            </div>
          </li>
          
          <li>
            
            <div class="item-inner">
              <p class="item-category">
                
              </p>
              <p class="item-title">
                <a href="/blog/posts/7deb74e6.html" class="title">编译编译器</a>
              </p>
              <p class="item-date">
                <time datetime="2022-01-17T13:55:50.000Z" itemprop="datePublished">2022-01-17</time>
              </p>
            </div>
          </li>
          
          <li>
            
            <div class="item-inner">
              <p class="item-category">
                
              </p>
              <p class="item-title">
                <a href="/blog/posts/aa24c566.html" class="title">编写changelog</a>
              </p>
              <p class="item-date">
                <time datetime="2021-08-13T07:59:30.000Z" itemprop="datePublished">2021-08-13</time>
              </p>
            </div>
          </li>
          
      </ul>
    </div>
  </div>
  

    
  </div>
</aside>

  
  
<main class="main" role="main">
  <div class="content">
  <article id="post-FileSystem/lvm" class="article article-type-post" itemscope itemtype="http://schema.org/BlogPosting">
    
    <div class="article-header">
      
        
  
    <h1 class="article-title" itemprop="name">
      lvm
    </h1>
  

      
      <div class="article-meta">
        <span class="article-date">
    <i class="icon icon-calendar-check"></i>
	<a href="/blog/posts/624d6a49.html" class="article-date">
	  <time datetime="2021-03-28T16:00:00.000Z" itemprop="datePublished">2021-03-29</time>
	</a>
</span>
        
        
  <span class="article-tag">
    <i class="icon icon-tags"></i>
	<a class="article-tag-link" href="/blog/tags/fs/" rel="tag">fs</a>, <a class="article-tag-link" href="/blog/tags/lvm/" rel="tag">lvm</a>
  </span>


        
	<span class="article-read hidden-xs">
	    <i class="icon icon-eye-fill" aria-hidden="true"></i>
	    <span id="busuanzi_container_page_pv">
			<span id="busuanzi_value_page_pv">0</span>
		</span>
	</span>


        <span class="post-comment"><i class="icon icon-comment"></i> <a href="/blog/posts/624d6a49.html#comments" class="article-comment-link">评论</a></span>
        
      </div>
    </div>
    <div class="article-entry marked-body" itemprop="articleBody">
      
        <h2 id="简介"><a href="#简介" class="headerlink" title="简介"></a>简介</h2><p>LVM(Logical Volume Manager) 是Linux下基于物理块设备(磁盘和磁盘分区等)之上创建虚拟块设备并对其进行管理的一种机制。相比直接管理物理设备，虚拟设备的管理会更加方便，也更容易拓展。LVM的出现解决了传统的磁盘管理会存在每个磁盘分区大小固定且无法动态拓展(不停止应用程序，不卸载文件系统)的问题。</p>
<h2 id="概念"><a href="#概念" class="headerlink" title="概念"></a>概念</h2><ul>
<li>PV：Physical Volume，物理卷，对应物理块设备，即分区或整个磁盘，或者是一个看起来像磁盘或分区的块设备。</li>
<li>PE：Physical Extend，物理拓展，PV被分成N个大小相同且容量较小的数据块，这是LV大小能够动态拓展的关键。</li>
<li>VG：Volume Group，卷组，一个VG中包含多个PV，VG负责管理其所有PV中的PE。</li>
<li>LV：Logical Volume，逻辑卷，对应于传统磁盘管理方式中的分区，类似的，使用LV时需要先创建文件系统，然后进行挂载。LV从VG中创建，且LV可以动态拓展，拓展时VG能够从被其管理的PV中分配PE给LV。</li>
<li>LE：Logical Extend，逻辑扩展，实际上就是PE，当VG中的某个PV的PE动态的分配给了LV，则该PE称之为LE。LVM会维护LV中的LE和PV中的PE的映射关系，例如VG中第1个LV中的第3个LE实际映射到VG中第2个PV的第100个PE，则当向LV1-3中写数据时，实际上是在往PV2-100中写数据，即最终写到物理磁盘或者分区上。</li>
</ul>
<h2 id="映射模型"><a href="#映射模型" class="headerlink" title="映射模型"></a>映射模型</h2><p>上面介绍LE时提到了LVM会维护LE到PE的映射关系，具体的映射方式包含以下两种：</p>
<ul>
<li>Linear：线性映射，即将LE按顺序映射到PE。</li>
<li>Striped：条纹映射，即LE被交叉映射到PE。</li>
</ul>
<h2 id="结构"><a href="#结构" class="headerlink" title="结构"></a>结构</h2><p>下图来自维基百科，其中的PP用PE或LE表示更恰当。<br><img src="/blog/images/FileSystem/lvm/Lvm.svg" alt="gpt"></p>
<h2 id="使用"><a href="#使用" class="headerlink" title="使用"></a>使用</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 测试前为系统新增了两块盘sda和sdc，且sda被划分为4个分区</span></span><br><span class="line">lsblk</span><br><span class="line"><span class="comment"># 输出结果</span></span><br><span class="line">NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT</span><br><span class="line">sda      8:0    0   20G  0 disk </span><br><span class="line">├─sda1   8:1    0    5G  0 part </span><br><span class="line">├─sda2   8:2    0    5G  0 part </span><br><span class="line">├─sda3   8:3    0    5G  0 part </span><br><span class="line">└─sda4   8:4    0    5G  0 part </span><br><span class="line">sdc      8:32   0   20G  0 disk </span><br><span class="line"></span><br><span class="line"><span class="comment"># 创建PV，该命令会创建5个PV，需要注意的是，所有用来做创建PV的块设备都必须是裸设备，即对于磁盘则不能存在分区表，对于分区不能存在文件系统，更进一步的理解：PV只关心物理块设备，其不区分磁盘、分区或者其他块设备的，只要对它而言这是块干净的块设备，能够知道这块设备的大小即可用于创建PV</span></span><br><span class="line">pvcreate /dev/sda1 /dev/sda2 /dev/sda3 /dev/sda4 /dev/sdc</span><br><span class="line"></span><br><span class="line"><span class="comment"># 查看PV信息，输出结果vgs命令一致，当PV不再VG中时，VG那一列显示为空</span></span><br><span class="line">pvs</span><br><span class="line"></span><br><span class="line"><span class="comment"># 使用PV创建VG，一个VG可以对应多个PV</span></span><br><span class="line">vgcreate MyVG1 /dev/sda1 /dev/sdc</span><br><span class="line">vgcreate MyVG2 /dev/sda2 /dev/sda3</span><br><span class="line">vgcreate MyVG3 /dev/sda4</span><br><span class="line"></span><br><span class="line"><span class="comment"># 查看VG</span></span><br><span class="line">vgs</span><br><span class="line"><span class="comment"># 输出结果</span></span><br><span class="line">PV         VG    Fmt  Attr PSize   PFree  </span><br><span class="line">/dev/sda1  MyVG1 lvm2 a--   &lt;5.00g  &lt;5.00g</span><br><span class="line">/dev/sda2  MyVG2 lvm2 a--   &lt;5.00g  &lt;5.00g</span><br><span class="line">/dev/sda3  MyVG2 lvm2 a--   &lt;5.00g  &lt;5.00g</span><br><span class="line">/dev/sda4  MyVG3 lvm2 a--   &lt;5.00g  &lt;5.00g</span><br><span class="line">/dev/sdc   MyVG1 lvm2 a--  &lt;20.00g &lt;20.00g</span><br><span class="line"></span><br><span class="line"><span class="comment"># 创建LV，LV创建完成后就可以作为全新的块设备被系统检测到，这里比较特别的是既然LV是一个块设备，那么PV也一样可以基于LV创建(套娃!)</span></span><br><span class="line">lvcreate -L 6G -n mylv1 MyVG1</span><br><span class="line">lvcreate -L 2G -n mylv2 MyVG1</span><br><span class="line">lvcreate -L 8G -n mylv3 MyVG2</span><br><span class="line">lvcreate -L 2G -n mylv4 MyVG1</span><br><span class="line"></span><br><span class="line"><span class="comment"># 查看块设备</span></span><br><span class="line">lsblk</span><br><span class="line"><span class="comment"># 输出结果如下，需要注意的是：1. mylv1占用6G，而MyVG1中的第1个PV只有5G，默认情况mylv1被MyVG1分配到第2个PV中，即mylv1中的LEs映射到了MyVG1中第2个PV的PEs；2. mylv3占用8G，而MyVG2中的2个PV分别只有5G，因此最终mylv3中的LEs分别被映射到这2个PEs中了；3. lv的最终名称为其所在的VG的名称拼接上LV的名称。</span></span><br><span class="line">NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT</span><br><span class="line">sda               8:0    0   20G  0 disk </span><br><span class="line">├─sda1            8:1    0    5G  0 part </span><br><span class="line">│ ├─MyVG1-mylv2 253:1    0    2G  0 lvm  </span><br><span class="line">│ └─MyVG1-mylv4 253:3    0    2G  0 lvm  </span><br><span class="line">├─sda2            8:2    0    5G  0 part </span><br><span class="line">│ └─MyVG2-mylv3 253:2    0    8G  0 lvm  </span><br><span class="line">├─sda3            8:3    0    5G  0 part </span><br><span class="line">│ └─MyVG2-mylv3 253:2    0    8G  0 lvm  </span><br><span class="line">└─sda4            8:4    0    5G  0 part </span><br><span class="line">sdc               8:32   0   20G  0 disk </span><br><span class="line">└─MyVG1-mylv1   253:0    0    6G  0 lvm </span><br><span class="line"></span><br><span class="line"><span class="comment"># 为lv创建文件系统</span></span><br><span class="line">mkfs.ext4 /dev/MyVG1/mylv1 <span class="comment"># 或者/dev/mapper/MyVG1-mylv1，下同</span></span><br><span class="line">mkfs.xfs /dev/MyVG1/mylv2</span><br><span class="line"></span><br><span class="line"><span class="comment"># 创建挂载目录</span></span><br><span class="line">mkdir /mnt/&#123;mylv1,mylv2&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment"># 挂载lv, 挂载完成后就可以进入挂载目录读写文件了</span></span><br><span class="line">mount /dev/MyVG1/mylv1 /mnt/mylv1</span><br><span class="line">mount /dev/MyVG1/mylv2 /mnt/mylv2</span><br></pre></td></tr></table></figure>

<h2 id="参考文档"><a href="#参考文档" class="headerlink" title="参考文档"></a>参考文档</h2><ul>
<li><a href="https://tldp.org/HOWTO/LVM-HOWTO/index.html" target="_blank" rel="noopener">LVM-HOWTO</a></li>
</ul>

      
    </div>
    <div class="article-footer">
      <blockquote class="mt-2x">
  <ul class="post-copyright list-unstyled">
    
    <li class="post-copyright-link hidden-xs">
      <strong>本文链接：</strong>
      <a href="https://gycherish.gitee.io/blog/posts/624d6a49.html" title="lvm" target="_blank" rel="external">https://gycherish.gitee.io/blog/posts/624d6a49.html</a>
    </li>
    
    <li class="post-copyright-license">
      <strong>版权声明： </strong> 本博客所有文章除特别声明外，均采用 <a href="http://creativecommons.org/licenses/by/4.0/deed.zh" target="_blank" rel="external">CC BY 4.0 CN协议</a> 许可协议。转载请注明出处！
    </li>
  </ul>
</blockquote>


<div class="panel panel-default panel-badger">
  <div class="panel-body">
    <figure class="media">
      <div class="media-left">
        <a href="https://gitee.com/gycherish" target="_blank" class="img-burn thumb-sm visible-lg">
          <img src="/blog/images/head.jpg" class="img-rounded w-full" alt="">
        </a>
      </div>
      <div class="media-body">
        <h3 class="media-heading"><a href="https://gitee.com/gycherish" target="_blank"><span class="text-dark">惘客</span><small class="ml-1x">Linux C++ Server Developer</small></a></h3>
        <div>宁静致远，淡泊明志！</div>
      </div>
    </figure>
  </div>
</div>


    </div>
  </article>
  
    
  <section id="comments">
  	
  </section>


  
</div>

  <nav class="bar bar-footer clearfix" data-stick-bottom>
  <div class="bar-inner">
  
  <ul class="pager pull-left">
    
    <li class="prev">
      <a href="/blog/posts/53a9d197.html" title="基于Hexo_Git_Nginx自动化部署博客系统"><i class="icon icon-angle-left" aria-hidden="true"></i><span>&nbsp;&nbsp;上一篇</span></a>
    </li>
    
    
    <li class="next">
      <a href="/blog/posts/568e9854.html" title="mbr"><span>下一篇&nbsp;&nbsp;</span><i class="icon icon-angle-right" aria-hidden="true"></i></a>
    </li>
    
    
  </ul>
  
  
  <!-- Button trigger modal -->
  <button type="button" class="btn btn-fancy btn-donate pop-onhover bg-gradient-warning" data-toggle="modal" data-target="#donateModal"><span>赏</span></button>
  <!-- <div class="wave-icon wave-icon-danger btn-donate" data-toggle="modal" data-target="#donateModal">
    <div class="wave-circle"><span class="icon"><i class="icon icon-bill"></i></span></div>
  </div> -->
  
  
  <div class="bar-right">
    
    <div class="share-component" data-sites="weibo,qq,wechat,facebook,twitter" data-mobile-sites="weibo,qq,qzone"></div>
    
  </div>
  </div>
</nav>
  
<!-- Modal -->
<div class="modal modal-center modal-small modal-xs-full fade" id="donateModal" tabindex="-1" role="dialog">
  <div class="modal-dialog" role="document">
    <div class="modal-content donate">
      <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
      <div class="modal-body">
        <div class="donate-box">
          <div class="donate-head">
            <p>感谢您的支持，我会继续努力的!</p>
          </div>
          <div class="tab-content">
            <div role="tabpanel" class="tab-pane fade active in" id="alipay">
              <div class="donate-payimg">
                <img src="/blog/images/donate/alipay.jpg" alt="扫码支持" title="扫一扫" />
              </div>
              <p class="text-muted mv">扫码打赏，你说多少就多少</p>
              <p class="text-grey">打开支付宝扫一扫，即可进行扫码打赏哦</p>
            </div>
            <div role="tabpanel" class="tab-pane fade" id="wechatpay">
              <div class="donate-payimg">
                <img src="/blog/images/donate/wechatpay.jpg" alt="扫码支持" title="扫一扫" />
              </div>
              <p class="text-muted mv">扫码打赏，你说多少就多少</p>
              <p class="text-grey">打开微信扫一扫，即可进行扫码打赏哦</p>
            </div>
          </div>
          <div class="donate-footer">
            <ul class="nav nav-tabs nav-justified" role="tablist">
              <li role="presentation" class="active">
                <a href="#alipay" id="alipay-tab" role="tab" data-toggle="tab" aria-controls="alipay" aria-expanded="true"><i class="icon icon-alipay"></i> 支付宝</a>
              </li>
              <li role="presentation" class="">
                <a href="#wechatpay" role="tab" id="wechatpay-tab" data-toggle="tab" aria-controls="wechatpay" aria-expanded="false"><i class="icon icon-wepay"></i> 微信支付</a>
              </li>
            </ul>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>



</main>

  <footer class="footer" itemscope itemtype="http://schema.org/WPFooter">
	
	
    <ul class="social-links">
    	
        <li><a href="https://gitee.com/gycherish" target="_blank" title="Gitee" data-toggle=tooltip data-placement=top><i class="icon icon-gitee"></i></a></li>
        
        <li><a href="/blog/atom.xml" target="_blank" title="Rss" data-toggle=tooltip data-placement=top><i class="icon icon-rss"></i></a></li>
        
    </ul>

    <div class="copyright">
    	
        &copy; 2024 惘客
        
        <!-- <div class="publishby">
        	Theme by <a href="https://github.com/cofess" target="_blank"> cofess </a>base on <a href="https://github.com/cofess/hexo-theme-pure" target="_blank">pure</a>.
        </div> -->
        <div class="police">
            <img src="/blog/images/beian.png" style="float:left;" /><a href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=41152702000156" target="_blank">豫公网安备41152702000156号</a>
        </div>
        <div class="beianinfo">
            <a href="https://beian.miit.gov.cn/" target="_blank">豫ICP备2021012829号</a>
        </div>
    </div>
</footer>
  <script src="//cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script>
<script>
window.jQuery || document.write('<script src="js/jquery.min.js"><\/script>')
</script>

<script src="/blog/js/plugin.min.js"></script>


<script src="/blog/js/application.js"></script>


    <script>
(function (window) {
    var INSIGHT_CONFIG = {
        TRANSLATION: {
            POSTS: '文章',
            PAGES: '页面',
            CATEGORIES: '分类',
            TAGS: '标签',
            UNTITLED: '(未命名)',
        },
        ROOT_URL: '/blog/',
        CONTENT_URL: '/blog/content.json',
    };
    window.INSIGHT_CONFIG = INSIGHT_CONFIG;
})(window);
</script>

<script src="/blog/js/insight.js"></script>






   
<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>





   







<!-- 添加回到顶部按钮 -->
<div id="go-top"></div>
<style type="text/css">
#go-top {
 width:40px;height:40px;
 background-color:#8cc2ff;
 position:relative;
 border-radius:20px;
 position:fixed;right:10px;bottom:60px;
 cursor:pointer;display:none;
}
#go-top:after {
 content:" ";
 position:absolute;left:14px;top:14px;
 border-top:2px solid #fff;border-right:2px solid #fff;
 width:12px;height:12px;
 transform:rotate(-45deg);
}
#go-top:hover {
 background-color:#8A2BE2;
}
</style>
<script>
$(function () {
  var top=$("#go-top");
  $(window).scroll(function () {
    ($(window).scrollTop() > 300) ? top.show(300) : top.hide(200);
    $("#go-top").click(function () {
      $('body,html').animate({scrollTop:0});
      return false();
    })
  });
});
</script>
</body>
</html>